package com.yunhe.authority.domain.option;

import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.neo4j.ogm.annotation.GeneratedValue;
import org.neo4j.ogm.annotation.Id;
import org.neo4j.ogm.annotation.NodeEntity;
import org.neo4j.ogm.annotation.Relationship;

import java.io.Serializable;
import java.util.List;

/**
 * @ClassName Item
 * @Description TODO
 * @Author HeTao
 * @Date 2021/2/25 9:33
 * @Version 1.0
 **/
@ApiModel(value = "Item",description = "枚举条目")
@NodeEntity
public class Item implements Comparable<Item>, Serializable {
    @Id
    @GeneratedValue
    @ApiModelProperty("条目id")
    private Long id;
    @ApiModelProperty("条目代码")
    private String code;
    @ApiModelProperty("国际化")
    private String name;
    @ApiModelProperty("条目title")
    private String title;
    @JsonIgnore
    private String activity="1";
    @ApiModelProperty("排序字段")
    private String sn;
    @Relationship(type = "HAS_CHILD")
    private List<Item> children;

    @Override
    public int compareTo(Item o) {
        if (this.sn == null) {
            return -1;
        } else if (o.getSn() == null) {
            return 1;
        }
        return this.sn.compareTo(o.getSn());
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getActivity() {
        return activity;
    }

    public void setActivity(String activity) {
        this.activity = activity;
    }

    public String getSn() {
        return sn;
    }

    public void setSn(String sn) {
        this.sn = sn;
    }

    public List<Item> getChildren() {
        return children;
    }

    public void setChildren(List<Item> children) {
        this.children = children;
    }
}
